package medecin.android;

import android.app.Activity;
import android.app.ListActivity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Toast;
import java.util.List;
import modele.DAO;

public class MainActivity extends ListActivity
{
    @Override
        protected void onListItemClick(ListView l, View v, int position, long id) {

        Intent inter = new Intent(this, autreActivity.class);
        inter.putExtra("leDep", l.getItemAtPosition(position).toString());
        startActivity(inter);
        
    }


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        List<String> lesDeps = DAO.getLesDeps();
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, lesDeps);
        setListAdapter(adapter);
//
//Button button = (Button) findViewById(R.id.buttonAffi);
//        button.setOnClickListener(new View.OnClickListener() {
//
//            public void onClick(View arg0) {
//
//                Toast.makeText(getApplicationContext(), "Saluut toiii laa", Toast.LENGTH_LONG).show();
//
//            }
//
//        });
//

    }

}
